
import { Injectable } from '@nestjs/common';
import { join } from 'path';
import { promises as fs } from 'fs';
import { Multer } from 'multer';

@Injectable()
export class UploadService {
  async saveFile(file: Multer.File): Promise<string> {
    const filePath = join(__dirname, '../../../static', file.originalname);
    await fs.writeFile(filePath, file.buffer);
    return filePath;
  }
}
